'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    baseController = require('../../../Base/server/controllers/BaseDoc.js');

var newModel = baseController.getBaseDocFields();
newModel.Code = {
    type: String,
    default: '',
    trim: true
};
newModel.Name = {
    type: String,
    default:'',
    trim: true
};
//上游部门
newModel.UpDepartment = {
    type: Schema.ObjectId,
    ref: 'Department'
};
//下游部门
newModel.DownDepartment = {
    type: Schema.ObjectId,
    ref: 'Department'
};
//配送模式，0:物流小车，1: 人工
newModel.DeliveryMode = {
    type: Number
};
//推拉模式，0:推式，1: 拉式
newModel.PushPullMode = {
    type: Number
};
newModel.IsEffective = {
    type: Boolean
};

var newSchema = new Schema(newModel);
newSchema.index({Code: 1}, {"unique": true});

mongoose.model('ConnectArea', newSchema, 'ConnectArea');
